package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.service.ISysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author suntf
 * @version 1.0
 * @date 2023/7/30 上午9:12
 */
@RequestMapping("region")
@RestController
public class SysRegionController {

    @Autowired
    ISysRegionService regionService;

    /**
     * 获取下级组织，如果不传递，获取所有
     * @author: suntf
     * @date: 2023/7/30 上午9:18
     * @param regionId
     * @return com.ruoyi.common.core.domain.R
     */
    @GetMapping("getRegion/{regionId}")
    public R getRegion(@PathVariable String regionId) {
        return R.ok(regionService.getRegion(regionId));
    }


    /**
     * 获取内容
     * @author: suntf
     * @date: 2023/8/2 下午10:38
     * @param code
     * @return com.ruoyi.common.core.domain.R
     */
    @GetMapping("getRegionByCode/{code}")
    public R getRegionByCode(@PathVariable String code) {
        return R.ok(regionService.getRegionByCode(code));
    }

}
